home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / boost4.zip / MANUAL.400 < prev    next >
Text File  |  1988-03-28  |  54KB  |  1,308 lines

  1.                          BOOSTERS 4.0
  2.               Tools for Turbo Pascal Programmers
  3.  
  4.                           Users Guide
  5.                             Part I
  6.  
  7.           Copyright (C) 1988 George F. Smith & Company
  8.                       All Rights Reserved
  9.  
  10. The Boosters library of routines and its documentation are 
  11. protected by the Copyright Laws of the United States.  They 
  12. may not be resold, distributed, or copied without permission 
  13. in writing from George F. Smith and Company.  The only 
  14. exception is the right of the purchaser of Boosters to make an 
  15. archival copy of the distribution diskettes as a means of 
  16. securing his or her investment.
  17.  
  18. For information about Boosters, please contact:
  19.  
  20.                    George F. Smith & Company
  21.                       609 Candlewick Lane
  22.                        Lilburn, GA 30247
  23.                         (404) 923-6879
  24.  
  25.  
  26.  
  27.  
  28.  
  29. Trademarks
  30. ----------
  31.  
  32. Turbo Pascal is a trademark of Borland International, Inc., 
  33. Scotts Valley, CA.
  34. IBM PC, PS/2 are products of International Business Machines, 
  35. Inc., Boca Raton, FL.
  36.  
  37.  
  38. Acknowledgements
  39. ----------------
  40.  
  41. I wish to thank Bill Meyer of Doraville, Georgia and John 
  42. Jones of LaGrange Park, Illinois for their invaluable aid in 
  43. getting Boosters ready for Turbo Pascal 4.0.  They served as 
  44. testers, advisers, and in John's case, a producer of the 
  45. labels for the distribution diskettes.  
  46.  
  47.  
  48.  
  49.  
  50. Boosters in General
  51. -------------------
  52.  
  53. Boosters was conceived and created to make professional or 
  54. often-used programming techniques readily available whenever I 
  55. needed them.  It occurred to me that other programmers may 
  56. find them useful, so through various channels they have made 
  57. it to PCs all across North America and to more exotic places I 
  58. someday hope to visit, such as Finland and Australia.  
  59.  
  60. Boosters supports string, video, heap, dos, and special-effects 
  61. routines in TEXT mode, for any IBM PC/PS or true compatible.  
  62. Many Boosters routines are coded in assembly language for speed 
  63. and compactness.  
  64.  
  65. Nowadays, of course, windowed video interfaces are standard 
  66. components of most programs, even Q&Ds.  As an aid in getting 
  67. (text) screens defined quickly and easily, Boosters also 
  68. includes ScrGen, a screen generator.  It comes with three 
  69. online help panels and has been converted and upgraded for the 
  70. current release.  ScrGen lets you create and edit screens, 
  71. while Boosters provides routines that allow programs to access 
  72. the screens and use them in your programs.
  73.  
  74.  
  75.  
  76. Boosters Version 4.0 
  77. --------------------
  78.  
  79. Boosters has been available as a support library for Turbo 
  80. Pascal since November, 1985.  None of the earlier releases
  81. will work correctly with Turbo Pascal 4.0 (or higher), due
  82. to fundamental changes in the operation of the compiler.
  83.  
  84. The most recent release of Boosters prior to 4.0 was 2.01, 
  85. which like its predecessors was a combination of inline 
  86. and Pascal routines.  To use a given routine from one of the 
  87. older versions, it was necessary to $Include it from a disk 
  88. file or copy it into the editor file.  
  89.  
  90. With version 4.0, programmers have in effect an extension of 
  91. the Pascal language.  By simply coding a "Uses Boosters;" 
  92. statement at the beginning of a program, they have access to 
  93. 90 functions and procedures as defined and linked by the 
  94. Boosters Unit (Boosters.TPU).
  95.  
  96. A simple 'Hello, world' program under version 4.0 might look 
  97. like:
  98.  
  99.         Program World;
  100.         Uses Boosters;
  101.         begin
  102.            PutStr (h,'Hello, World',1,1,14);
  103.         end.
  104.  
  105. Fortunately, most of the changes to the Boosters library in 
  106. version 4.0 are internal to the routines.  They do not affect 
  107. the manner in which they are used in a Turbo Pascal program.  
  108. There are some important distinctions and assumptions, 
  109. however, that we will now discuss in detail.
  110.  
  111.  
  112.  
  113. BOOSTERS UNIT
  114. -------------
  115.  
  116. As mentioned, the Boosters library is now a Turbo Pascal Unit, 
  117. which means that the Boosters.TPU file must be accessible to 
  118. your programs.  You have been provided both the TPU and the 
  119. PAS version of the unit on the distribution diskettes.  
  120.  
  121.  
  122. h, v, and heap
  123. --------------
  124. Within the interface section of the Boosters unit are type, 
  125. constant, and variable definitions that in previous versions 
  126. were located in file BoDecl.Pas.  Version 4.0 retains the 
  127. constants 'h' and 'v' for use with PutStr and GetStr, as well 
  128. as names relating to heap operations, such as HeapBuf and 
  129. HeapTop.  
  130.  
  131. However, the interface section has dropped
  132.  
  133.         Page : array[1..2] of HeapBuf;
  134.  
  135. and replaced it with
  136.  
  137.         Hpage : HeapBuf;
  138.  
  139. In your programs, therefore, you will have to define the heap 
  140. pages you are accessing.  As a suggestion, you could use:
  141.  
  142.         Const
  143.            Npage = 5;
  144.  
  145.         Var
  146.            Page : array[1..Npage] of HeapBuf;
  147.            i    : Integer;
  148.         .
  149.         .
  150.         .
  151.         BEGIN
  152.            Mark (HeapTop);
  153.            for i := 1 to Npage do New(Page[i]);
  154.            .
  155.            .
  156.            .
  157.            Release (HeapTop);
  158.         END.  { Main Program }
  159.  
  160. Please notice that the variable 'i' will now be defined in 
  161. your programs, as well.  It is not necessary to manage the 
  162. heap with Mark and Release, but it is necessary to manage the 
  163. heap, so take care.  Turbo Pascal v4.0 has a new compiler 
  164. directive, $M, that allows you to establish stack, minimum 
  165. heap, and maximum heap sizes.  See page 534 of the Turbo 
  166. Pascal v4.0 manual for a definition of $M.  (If you use Turbo 
  167. Pascal's Exec procedure, you must override the $M heapmax 
  168. default to make room for the child process.)
  169.  
  170.  
  171. ColumnType and RowType
  172. ----------------------
  173. Also, Boosters no longer has the ColumnType and RowType 
  174. definitions.  The heap and video routines that used these 
  175. defintions have been redefined to accept integers as
  176. replacements.  
  177.  
  178.  
  179. Dos Registers and Ch
  180. --------------------
  181. Turbo Pascal comes with units of its own, most notably Crt and 
  182. Dos.  Both of these units are used by the Boosters unit.  
  183. Within the Dos unit is a definition of the 8088's registers, 
  184. called, appropriately, 'registers' (see page 299).  As you will 
  185. notice, Boosters.Pas uses the Dos unit's definition of this 
  186. Type and calls it 'regs'--just as in previous Boosters 
  187. versions.
  188.  
  189. Since the Dos registers Type includes definitions for the 8-
  190. bit registers, one of which is named Ch, I decided to drop the 
  191. definition of the Char type, Ch, from the Boosters unit.  
  192.  
  193.  
  194. AnyString
  195. ---------
  196. Boosters' Type AnyString = string[255] is no longer needed 
  197. since Turbo Pascal now has a Type String with the same 
  198. definition.  The generic string variable 's' is no longer part 
  199. of Boosters.  The demonstration programs use
  200.  
  201.         var s : string;
  202.  
  203. as a general string variable.
  204.  
  205.  
  206. SnowRemoval and VideoSeg
  207. ------------------------
  208. Earlier versions of Boosters had code embedded in each video 
  209. routine that attempted to isolate the CGA from other video 
  210. adapters so the programs could perform their functions at 
  211. maximum speed without creating snow on the screen.  
  212.  
  213. There were several problems with this approach.  One, the 
  214. Boosters routines could not distinguish between a CGA and an 
  215. EGA, for instance, and ended up executing snow removal code 
  216. when it wasn't necessary.  Two, executing snow removal 
  217. routines slows video operations.  So for an EGA, for instance, 
  218. programmers (and users of their programs) had to pay a speed 
  219. penalty.  Three, Boosters gave programmers no choice about 
  220. whether to remove snow or not.  There are users who would 
  221. gladly tolerate some snow for an increase in performance, 
  222. especially since the snow effect can be neutralized somewhat 
  223. through the use of colored screen backgrounds.
  224.  
  225. Boosters v4.0 largely corrects this situation.  It uses a 
  226. boolean variable, SnowRemoval, to determine whether to execute 
  227. snow removal code or not.  SnowRemoval is initialized to FALSE 
  228. in the initialization section of the Boosters unit.  Your 
  229. programs can manipulate this variable based on user input or 
  230. adapter board detection code.  A commercial product called 
  231. Turbo Express, available at many software outlets, comes with 
  232. adapter board detection algorithms, I'm told.  Anyway, with 
  233. SnowRemoval set to FALSE, the video routines will NOT perform 
  234. snow removal, which for virtually all boards is unnecessary.  
  235.  
  236. Each assembler video routine used to inspect location 449h to 
  237. determine whether the adapter board installed was monochrome 
  238. (7) or graphics (not 7).  Monochrome adapters start video 
  239. memory at segment B000h, while grpahics adapters start at 
  240. B800h.  For version 4.0, this logic has been moved out of the 
  241. assembler routines and into the initialization section of the 
  242. Boosters unit.  This again places control of the video segment 
  243. address into the programmer's hands, while in theory picking 
  244. up some speed during execution.  
  245.  
  246. Boosters tests LastMode, a Turbo Pascal variable, to determine 
  247. whether to assign VideoSeg a value of B000h or B800h. 
  248.  
  249.  
  250.  
  251. The New and the Missing
  252. -----------------------
  253. New routines for Boosters include the following:
  254.  
  255.         Dow 
  256.         Fil2Heap
  257.         GchaHeap
  258.         GetHeap
  259.         GetSize
  260.         Input2
  261.         PchaHeap
  262.         SplitCloseH
  263.         SplitCloseV
  264.         SplitOpenH
  265.         SplitOpenV
  266.         Translate
  267.         Verify
  268.         WordInd
  269.  
  270. In addition, several others have been modified either in name 
  271. or function:
  272.  
  273.         ChooseOption .. Returns last key pressed
  274.         Fstr .......... Argument type changed from Integer to
  275.                         LongInt
  276.         FstrHeap ...... Now allows users to set starting x,y
  277.                         values for search)
  278.         HeapAtt ....... Formerly HeapAt
  279.         Hwipe ......... First argument is Page:HeapBuf rather than
  280.                         Page:Integer
  281.         Input ......... Fixes a problem with moving left over blank 
  282.                         filters
  283.         ShowDate ...... Added a parameter to specify attribute
  284.         ShowTime ...... Added a parameter to specify attribute
  285.         Vwipe ......... First argument is Page:HeapBuf rather than
  286.                         Page:Integer
  287.         Wait .......... Returns key pressed during pause
  288.         WordN ......... Formerly Word
  289.  
  290.  
  291. Missing from the lineup is the Exec procedure, a version of 
  292. which is now included with the Dos unit.  Memory size 
  293. requirements are coded with the $M directive, rather than as 
  294. an argument to the procedure.
  295.  
  296.  
  297.  
  298. Using Boosters with the heap
  299. ----------------------------
  300.  
  301. Under Boosters, the heap serves as offstage video memory.  The 
  302. heap routines always assume they are working with a character-
  303. attribute layout.  Using the heap in this manner allows you to 
  304. retain and manipulate complex or otherwise important video 
  305. data without first converting it.  And since data on the heap 
  306. is display-ready, it can be copied to video memory 
  307. instantaneously.   
  308.  
  309. With your data residing on the heap, there is no limit to the 
  310. amount of memory available, other than physical- or operating 
  311. system-imposed restrictions.
  312.  
  313. As an example of using the heap with Boosters, let's assume 
  314. you have an application that requires one main menu and a help 
  315. screen.  First, create the screens with ScrGen, saving them to 
  316. a file named Sample.Gen.  Save the main menu as screen 1, the 
  317. help panel as screen 2.  While you're in ScrGen and working 
  318. with the main menu, use the ruler (Alt-U) to note the 
  319. coordinates of the menu's selections.
  320.  
  321. Your program to control the screens and the users' responses 
  322. might look something like the following:
  323.  
  324. Program Sample;
  325. Uses Crt,Boosters;
  326.  
  327. Const
  328.    npage = 2;   { number of heap pages to allocate }
  329.    F1 = #59;    { F1 invokes the help screen }
  330.    AltX = #45;  { Alt-X ends the program }
  331.  
  332. var
  333.    i,
  334.    ecode : Integer
  335.    Page  : array[1..npage] of HeapBuf;  { HeapBuf is defined
  336.                                           in Boosters.Pas }
  337.    UserQuits : Boolean;
  338.    c : char;
  339.  
  340. BEGIN
  341.  
  342.    {--- Initialize variables ---}
  343.    UserQuits := false;
  344.  
  345.    {--- Mark and allocate heap storage ---}
  346.    Mark ( HeapTop );
  347.    for i := 1 to npage do new ( page[i] );
  348.  
  349.    {--- Read ScrGen files into heap memory ---}
  350.    {    the main menu will be on page 1,      }
  351.    {    the help panel on page 2              }
  352.    Fil2Heap ( 'Sample.Gen', 1, npage, Page[1], Ecode );
  353.  
  354.    {--- If an error occurred, display message and halt ---}
  355.    if ecode > 0 then begin
  356.       putstr ( h,'Error reading Sample.Gen',1,1,14);
  357.       exit;
  358.    end;
  359.  
  360.    {--- Display the main menu from page 1 of the heap ---}
  361.    RestoreScreen ( Page[1] );
  362.  
  363.    {--- Process the user's key strokes ---}
  364.    repeat
  365.       c := readkey;
  366.       if c = #0 then begin
  367.          c := readkey;
  368.          case c of
  369.             F1  : begin   
  370.                     {--- display help screen ---}
  371.                      RestoreScreen ( Page[2] );
  372.  
  373.                      {--- Wait for user's keypress ---}
  374.                      c := readkey;
  375.                      if c := #0 then c := readkey;
  376.  
  377.                      {--- Restore main menu ---}
  378.                      RestoreScreen ( Page[1] );
  379.                   end;
  380.                   {--- Set flag when user presses Alt-X ---}
  381.            AltX : UserQuits := true;
  382.            .
  383.            .    {--- Process other keys ---}
  384.            .
  385.  
  386.          end;  { case }
  387.      .
  388.      .   {--- Execute the user's menu choices ---} 
  389.      .
  390.    until UserQuits;
  391.  
  392.    Release ( HeapTop );
  393.  
  394. END.   { Sample program }
  395.  
  396.  
  397. For additional examples of using Boosters in Turbo Pascal 
  398. programs, you are strongly urged to review the demonstration 
  399. programs provided with the distribution diskettes.
  400.  
  401.  
  402.  
  403. Reference Guide
  404. ---------------
  405.  
  406. This section describes the routines of Boosters version 4.0.  
  407. The routines are presented alphabetically.
  408.  
  409. The declarations that follow assume these definitions,
  410. which are included in Boosters.Pas:
  411.  
  412.         Type
  413.            HeapBuf = ^AnyBuf;
  414.            AnyBuf  = Record
  415.                         Screen : Array[1..4000] of Byte;
  416.                      End;
  417.         Var
  418.            HPage   : HeapBuf;
  419.  
  420. The heap examples assume Page to be defined as an array of
  421. HeapBuf:
  422.  
  423.         Const
  424.            Npage = 2;  { Number of heap pages }
  425.  
  426.         Var
  427.            Page : array[1..Npage] of HeapBuf;
  428.  
  429.  
  430. -----------------------------------------------------------
  431. BoDir Procedure
  432. -----------------------------------------------------------
  433. Purpose         Displays a windowed directory
  434. Declaration     BoDir ( var FileSpec,FileName : String;
  435.                         x1,y1,x2,y2 : Integer;
  436.                         style, attr : byte );
  437. Remarks         Displays the directory specified in FileSpec 
  438.                 within a box defined by (x1,y1), (x2,y2).
  439.                 Style and attr define the box's line-type
  440.                 and video attribute.  
  441.  
  442.                 The box size must have as a minimum x2 >
  443.                 (x1+16) and y2 > (y1+3).
  444.  
  445.                 The directory is windowed within the box.
  446.                 Files are identified by color:
  447.                    User files     - intense yellow
  448.                    Subdirectories - intense red
  449.                    Volume labels  - green-blue bkgrnd
  450.                    Hidden files   - intense yellow/blue
  451.  
  452.                 When a box is full or the directory is
  453.                 exhausted, BoDir pauses and waits for one
  454.                 of these keypresses:
  455.                    Cursor key - point to next file name
  456.                                 in current row/column.
  457.                    Enter      - Select file and assign it
  458.                                 to FileName
  459.                    Escape     - Abort directory display and
  460.                                 set FileName to null.
  461.                    PgDn       - Display more directory entries
  462.                                 or abort the display if none
  463.                                 are found.  FileName is set to
  464.                                 null.
  465. Example         Display the default directory.
  466.                    CurPath := '';
  467.                    FileSpec := '';
  468.                    BoDir ( FileSpec,FileName,20,5,60,12,1,14);
  469.  
  470. -----------------------------------------------------------
  471. BoErase Procedure
  472. -----------------------------------------------------------
  473. Purpose         Erases the specified file from disk.
  474. Declaration     BoErase ( FileName : String; 
  475.                           var Ecode : Integer );
  476. Remarks         Wild cards are not allowed.  
  477.                 Ecode values:
  478.                         0 - successful
  479.                         2 - file not found
  480.                         5 - access denied
  481. Example         Erase Temp.Doc from the current directory.
  482.                    BoErase ('Temp.Doc',Ecode);
  483.                    if Ecode = 0 then 
  484.                       PutStr (h,'File erased',1,1,14);
  485.  
  486. -----------------------------------------------------------
  487. BoRename Procedure
  488. -----------------------------------------------------------
  489. Purpose         Renames a file on the current directory.
  490. Declaration     BoRename ( OldName, NewName : String;
  491.                            var Ecode : Integer);
  492. Remarks         Take care to ensure that NewName does not
  493.                 already exist.
  494.                 Ecode values:
  495.                         0 - successful
  496.                         2 - OldName not found
  497.                         3 - Path not found
  498.                         5 - access denied
  499. Example         Rename Temp.Doc to Save.Doc.
  500.                    BoRename ( 'Temp.Doc','Save.Doc',Ecode);
  501.                    if ecode = 0 then
  502.                       pdq ('e','File successfully renamed',1,1,14);
  503.  
  504. -----------------------------------------------------------
  505. Box Procedure
  506. -----------------------------------------------------------
  507. Purpose         Draws a box on the screen.
  508. Declaration     Box ( x1,y1,x2,y2,style,att : Integer);
  509. Remarks         Draws a box at (x1,y1) and (x2,y2), which
  510.                 specifiy the upper-right and lower-left
  511.                 coordinates, respectively.
  512.  
  513.                 Box does not clear the box interior.  Use
  514.                 Remblk or RemBlkr to clear the area inside
  515.                 the box.
  516.  
  517.                 If Style > 4, then the sides of the box are
  518.                 drawn with chr(style).  If Style is in [1..4],
  519.                 then Box draws a rectangle using the special
  520.                 box-drawing characters:
  521.  
  522.                    Style        Sides
  523.                      1          single line
  524.                      2          double line
  525.                      3          top & bottom single,
  526.                                 others double
  527.                      4          top & bottom double,
  528.                                 others single
  529.  
  530.                 Att sets the video attribute of the box sides.
  531. See also        BoxHeap
  532. Example         Draw an 80x25 box.
  533.                    ClrScr;
  534.                    Box ( 1,1,80,25,1,14);
  535.  
  536. -----------------------------------------------------------
  537. BoxHeap Procedure
  538. -----------------------------------------------------------
  539. Purpose         Draws a box on a page of the heap.
  540. Declaration     BoxHeap ( Page : Heapbuf; 
  541.                           x1,y1,x2,y2,style,att : Integer);
  542. Remarks         Draws a box at (x1,y1) and (x2,y2), which
  543.                 specifiy the upper-right and lower-left
  544.                 coordinates, respectively.
  545.  
  546.                 BoxHeap does not clear the box interior.  Use
  547.                 FillHeap to clear the area inside the box.
  548.  
  549.                 If Style > 4, then the sides of the box are
  550.                 drawn with chr(style).  If Style is in [1..4],
  551.                 then Box draws a rectangle using the special
  552.                 box-drawing characters:
  553.  
  554.                    Style        Sides
  555.                      1          single line
  556.                      2          double line
  557.                      3          top & bottom single,
  558.                                 others double
  559.                      4          top & bottom double,
  560.                                 others single
  561.  
  562.                 Att sets the video attribute of the box sides.
  563. See also        Box
  564. Example         Draw a box on the heap and display it.
  565.                    ClrScr;
  566.                    SaveScreen ( Page[1] );
  567.                    BoxHeap ( Page[1],10,5,70,15,1,14);
  568.                    Heap2Scr ( Page[1],10,5,70,15,10,5);
  569.  
  570. -----------------------------------------------------------
  571. Calendar Procedure
  572. -----------------------------------------------------------
  573. Purpose         Draws a calendar on the screen for the 
  574.                 specified month and year.
  575. Declaration     Calendar ( mm,year,StartCol,StartRow:Integer);
  576. Remarks         The year must be 4 digits - 1966, not 66.
  577.                 The upper-left screen coordinates of the
  578.                 calendar are given by (StartCol,StartRow).
  579.                 The calendar is 29 columns wide and 16 rows 
  580.                 long.
  581. See also        CalHeap
  582. Example         Display the calendar for December, 1982.
  583.                    Calendar ( 12, 1982, 25, 6 );
  584.  
  585. -----------------------------------------------------------
  586. CalHeap Procedure
  587. -----------------------------------------------------------
  588. Purpose         Draws a calendar on a page of heap for the 
  589.                 specified month and year.
  590. Declaration     CalHeap ( Page : HeapBuf; 
  591.                           mm,year,StartCol,StartRow:Integer);
  592. Remarks         The year must be 4 digits - 1966, not 66.
  593.                 The upper-left screen coordinates of the
  594.                 calendar are given by (StartCol,StartRow).
  595.                 The calendar is 29 columns wide and 16 rows
  596.                 long.
  597. See also        Calendar
  598. Example         Display the calendar for August, 1981.
  599.                    CalHeap ( Page[1], 8, 1981, 25, 6 );
  600.                    Heap2Scr ( Page[1], 25,6,53,21,1,1);
  601.  
  602. -----------------------------------------------------------
  603. CblkHeap Procedure
  604. -----------------------------------------------------------
  605. Purpose         Copies a block on a page of heap.
  606. Declaration     CblkHeap ( Page : HeapBuf; x1,y1,x2,y2,
  607.                            x3,y3 : Integer);
  608. Remarks         Copies the block on Page given by (x1,y1)
  609.                 and (x2,y2) to (x3,y3).
  610. See also        MblkHeap
  611. Example         Build and copy a box on a page of heap.
  612.                    BoxHeap  ( Page, 25,10,40,20,1,14);
  613.                    CblkHeap ( Page, 25,10,40,20,9,10);
  614.  
  615. -----------------------------------------------------------
  616. Center Function
  617. -----------------------------------------------------------
  618. Purpose         Returns a string centered within a field
  619.                 of specified width.
  620. Declaration     Center ( s : string; Width:Integer; Pad : Char);
  621. Result Type     String
  622. Remarks         S is centered in the result string, padded on
  623.                 the ends with Pad character.  If S is longer
  624.                 than Width, only the first Width characters of
  625.                 S are returned.
  626. See also        CtrScr
  627. Example         Center 'Boosters v4.0' on line 1 of the screen.
  628.                    PutStr (h,Center('Boosters v4.0',80,' '),
  629.                            1,1,30);
  630.  
  631. -----------------------------------------------------------
  632. ChgAtt Procedure
  633. -----------------------------------------------------------
  634. Purpose         Changes the attribute of a block in video
  635.                 memory.
  636. Declaration     ChgAtt (x1,y1,x2,y2 : Integer;
  637.                         FromAtt, ToAtt : byte);
  638. Remarks         Changes all FromAtt attributes to ToAtt
  639.                 attributes for the block defined by (x1,y1)
  640.                 and (x2,y2).
  641. See also        SetAtt, HeapAtt
  642. Example         Change red background attributes to blue.
  643.                    ChgAtt ( 1,1,40,15,$40,$10 );
  644.                 Note that only screen positions having a red
  645.                 background attribute ($40) will be changed to
  646.                 blue ($10).  All other positions will remain 
  647.                 the same.
  648.  
  649. -----------------------------------------------------------
  650. ChooseOption Procedure
  651. -----------------------------------------------------------
  652. Purpose         Allows the user to scroll a list of choices
  653.                 within a menu.
  654. Declaration     ChooseOption ( x1,y1,x2,y2,Nentries ; Integer;
  655.                                var lastkey : char );
  656. Remarks         Given a list of choices displayed within a 
  657.                 box, ChooseOption allows the user to wrap
  658.                 through the choices with the up and down
  659.                 arrow keys.  LastKey indicates whether the
  660.                 user canceled with Escape or selected with
  661.                 Enter.
  662.  
  663.                 (x1,y1) are the coordinates of the upper-left
  664.                 corner of the first selection (not the box),
  665.                 while (x2,y2) are the lower-right coordinates
  666.                 of the menu box.  Nentries is the number of
  667.                 entries in the menu.
  668. Example         Allow the user to choose from a menu of 3 items.
  669.                    Box (20,6,60,16,1,14);
  670.                    RemBlk ( 21,7,59,15);
  671.                    CtrScr ( 'e',"Menu',39,21,7,30);
  672.                    pdq ('e','Breakfast',22,10,14);
  673.                    pdq ('e','Lunch',22,11,14);
  674.                    pdq ('e','Dinner',22,12,14);
  675.                    ChooseOption ( 22,10,60,16,3,LastKey);
  676.                    if LastKey = #13 then begin
  677.                       GetStr ( h,s,22,WhereY,10);
  678.                       PutStr ( h,'Meal selected is '+
  679.                                strip(s,' '),1,1,14);
  680.                    end;
  681.  
  682. -----------------------------------------------------------
  683. CntCh Function
  684. -----------------------------------------------------------
  685. Purpose         Returns the number of occurrences of a 
  686.                 character in a string.
  687. Declaration     CntCh ( S : String; C : Char ) : Integer;
  688. Result Type     Integer
  689. Remarks         The search is case sensitive--'E' and 'e'
  690.                 are regarded as different characters.
  691. Example         Count all occurrences of all letter E's, 
  692.                 both upper- and lower-case.
  693.                    S := 'Easy does it';
  694.                    n := CntCh ( Upper(S),'E');
  695.  
  696. -----------------------------------------------------------
  697. Copies Function
  698. -----------------------------------------------------------
  699. Purpose         Returns N concatenated copies of character C.
  700. Declaration     Copies ( C : Char; N : Integer ) : String;
  701. Result Type     String
  702. See also        CopyStr
  703. Example         Create a string of 30 underscores.
  704.                    s := copies('_',30);
  705.  
  706. -----------------------------------------------------------
  707. CopyBlk Procedure
  708. -----------------------------------------------------------
  709. Purpose         Duplicates a block in video memory.
  710. Declaration     CopyBlk ( x1,y1,x2,y2,x3,y3 );
  711. Remarks         Copies the block at (x1,y1) and (x2,y2) to the
  712.                 location beginning at (x3,y3).
  713. See also        MoveBlk,CblkHeap
  714. Example         Create a box and copy it to another area of the
  715.                 screen.
  716.                    Box     ( 20,5,40,15,1,14 );
  717.                    CopyBlk ( 20,5,40,15,50,5 );
  718.  
  719. -----------------------------------------------------------
  720. CopyStr Function
  721. -----------------------------------------------------------
  722. Purpose         Returns N concatenated copies of string S.
  723. Declaration     CopyStr ( S : String; N : Integer ) : String;
  724. Result Type     String
  725. See also        Copies
  726. Example         Create 5 copies of 'beep-'.
  727.                    s := copies('beep-',5);
  728.  
  729. -----------------------------------------------------------
  730. CtrScr Procedure
  731. -----------------------------------------------------------
  732. Purpose         Center a string in video memory.
  733. Declaration     CtrScr (nsew : char; s : string; 
  734.                         length, x, y : Integer; att : byte);
  735. Remarks         Centers S on the screen within a field of 
  736.                 length 'length', which begins at (x,y).  Att
  737.                 specifies the attribute of the centered string.
  738.  
  739.                 NSEW determines the direction of output:
  740.                    N - North, bottom to top
  741.                    S - South, top to bottom
  742.                    E - East, left to right (normal)
  743.                    W - West, right to left
  744.  
  745.                 CtrScr does not alter the cursor position.
  746. See also        Pdq, PutStr
  747. Example         Center a string at the top pf the screen.
  748.                    CtrScr ('e','Page 1',80,1,1,30);
  749.  
  750. -----------------------------------------------------------
  751. CursorOff Procedure
  752. -----------------------------------------------------------
  753. Purpose         Makes the cursor invisible.
  754. Declaration     CursorOff;
  755. Remarks         Calls Bios interrupt 10h to turn off the
  756.                 cursor.
  757. See also        CursorOn, SetCursor
  758. Example         Remove the cursor from the screen.
  759.                    CursorOff;
  760.  
  761. -----------------------------------------------------------
  762. CursorOn Procedure
  763. -----------------------------------------------------------
  764. Purpose         Defines a cursor of standard size.
  765. Declaration     CursorOn;
  766. Remarks         Calls Bios interrupt 10h to set the cursor.
  767.                 Uses Boosters' VideoStatus variable to 
  768.                 determine whether monochrome or color screen.
  769. See also        CursorOff, SetCursor
  770. Example         Turn on the cursor.
  771.                    CursorOn;
  772.  
  773. -----------------------------------------------------------
  774. DiffOne Procedure
  775. -----------------------------------------------------------
  776. Purpose         Advances cursor to the first screen position
  777.                 different from the current one.
  778. Declaration     DiffOne ( EW : Char );
  779. Remarks         Places cursor at first position that does
  780.                 not match the character/attribute of current
  781.                 cursor position.  If EW is 'E' or 'e', the
  782.                 search is east (left-to-right).  If EW is 'W'
  783.                 or 'w', the search is west (right-to-left).
  784.  
  785.                 If DiffOne cannot find a non-matching position,
  786.                 it places the cursor at (80,25) for east 
  787.                 searches or (1,1) for west searches.
  788. Example         Advance the cursor to the next differing 
  789.                 position.
  790.                    DiffOne ( 'e' );
  791.  
  792. -----------------------------------------------------------
  793. Disk2Mem Procedure
  794. -----------------------------------------------------------
  795. Purpose         Copies a screen image from a disk file to a
  796.                 page of heap.
  797. Declaration     Disk2Mem ( FileDesc : String; 
  798.                            ScreenNumber : Integer;
  799.                            Page : HeapBuf;
  800.                            var Ecode : Integer );
  801. Remarks         FileDesc specifies the Drive/Path/FileName,
  802.                 while ScreenNumber indicates the screen
  803.                 number within the file to read.
  804.  
  805.                 Screens are 4000 bytes each and are assumed to
  806.                 be images of video memory (character/attribute
  807.                 pairs).  A common use of this procedure is to
  808.                 read files created with Boosters' ScrGen.
  809.  
  810.                 Ecode indicates the status of the operation:
  811.                    0 - Screen found and loaded onto heap
  812.                    3 - Path or file not found
  813.                    4 - no file handle available
  814.                    5 - access denied
  815. See also        Fil2Heap
  816. Example         Read screen 4 of a file into page 1 of heap memory,
  817.                 then display it.
  818.                    Disk2Mem ( 'Layout.Gen',4,page[1], Ecode );
  819.                    if Ecode = 0 then 
  820.                       RestoreScreen ( Page[1] );
  821.  
  822. -----------------------------------------------------------
  823. Dows Function
  824. -----------------------------------------------------------
  825. Purpose         Returns a day of the week string.
  826. Declaration     Dows ( Month, Day, Year : Integer ) : String;
  827. Result Type     String
  828. Remarks         The year must be 4 digits: for example, 1955.
  829.                 The strings returned are: Sunday, Monday, 
  830.                 Tuesday, Wednesday, Thursday, Friday,
  831.                 Saturday.  They are are returned exactly as
  832.                 shown, first letter capitalized.
  833. See also        Dow
  834. Example         Find the day of the week for December 14, 1982.
  835.                    s := dows( 12, 14, 1982 );
  836.                    pdq ('e','December 14, 1982 was a '+
  837.                         s,1,1,14);
  838.  
  839. -----------------------------------------------------------
  840. Dow Function
  841. -----------------------------------------------------------
  842. Purpose         Returns a day of the week index.
  843. Declaration     Dows ( Month, Day, Year : Integer ) : Integer;
  844. Result Type     Integer
  845. Remarks         The year must be 4 digits: for example, 1955.
  846.                 The values returned and their meaning are:
  847.                    0 - Sunday
  848.                    1 - Monday
  849.                    2 - Tuesday
  850.                    3 - Wednesday
  851.                    4 - Thursday
  852.                    5 - Friday
  853.                    6 - Saturday
  854. See also        Dows
  855. Example         Find the day of the week for December 14, 1982.
  856.                    if 'Days' is defined as:
  857.  
  858.                    const
  859.                       days : array[0..6] of string[2] = 
  860.                              ('Su','Mo','Tu','We','Th','Fr','Sa');
  861.                    
  862.                    then the function call for 12/14/1982 will be:
  863.  
  864.                    n := dow( 12, 14, 1982 );
  865.                    pdq ('e','December 14, 1982 was a '+
  866.                         days[n],1,1,14);
  867.  
  868. -----------------------------------------------------------------
  869. DriveCnt Function
  870. -----------------------------------------------------------
  871. Purpose         Returns the number of logical disk drives on 
  872.                 the host CPU.
  873. Declaration     DriveCnt : Integer;
  874. Result Type     Integer
  875. Remarks         This function issues a call to DOS function
  876.                 0Eh, which returns an initial drive count,
  877.                 then follows with repeated calls to DOS
  878.                 function 47h until the count is verified as
  879.                 correct.
  880. Example         Display the number of drives on the system.
  881.                    Write('Number of drives is ',DriveCnt);
  882.  
  883. -----------------------------------------------------------
  884. Fil2Heap Procedure
  885. -----------------------------------------------------------
  886. Purpose         Copies a range of screen images into a range
  887.                 of heap pages.
  888. Declaration     Fil2Heap ( FileDesc : String; 
  889.                            FromScreen, ToScreen : Integer;
  890.                            Page : HeapBuf;
  891.                            var Ecode : Integer );
  892. Remarks         FileDesc specifies the Drive/Path/FileName,
  893.                 while FromScreen, ToScreen indicate the 
  894.                 starting and ending screens to read into 
  895.                 the heap beginning at Page.
  896.  
  897.                 Screens are 4000 bytes each and are assumed to
  898.                 be images of video memory (character/attribute
  899.                 pairs).  A common use of this procedure is to
  900.                 read files created with Boosters' ScrGen.
  901.  
  902.                 Ecode indicates the status of the operation:
  903.                    0 - Screen found and loaded onto heap
  904.                    3 - Path or file not found
  905.                    4 - no file handle available
  906.                    5 - access denied
  907. See also        Disk2Mem
  908. Example         Read screens 4 through 7 into the heap beginning
  909.                 at Page[1].
  910.                    Fil2Heap ( 'Layout.Gen',4,7,page[1], Ecode );
  911.                    if Ecode = 0 then 
  912.                       RestoreScreen ( Page[1] );
  913.  
  914. -----------------------------------------------------------
  915. FileStamp Procedure
  916. -----------------------------------------------------------
  917. Purpose         Gets or sets a file's time/date stamp.
  918. Declaration     FileStamp ( FileName : String; 
  919.                             GetSet : Integer;
  920.                             Var Ecode : Integer );
  921. Remarks         Attempts to open FileName, read or write
  922.                 the time/date stamp, and close the file.
  923.                 GetSet = 0 for reading, GetSet = 1 for
  924.                 writing time/date.
  925.  
  926.                 Uses global variables:
  927.                    FileHH, FileMin, FileSec  (time)
  928.                    FileYY, FileMM,  FileDD   (date)
  929.  
  930.                 FileYY must be 4 digits - e.g., 1988.
  931.                 FileHH (hour) is in military format - 
  932.                 e.g., 2:00 p.m. is 14.
  933.  
  934.                 Ecode = 0 if the operation was successful,
  935.                 or a DOS error code if unsuccessful.
  936. See also        GetFtime (in Turbo Pascal DOS unit)
  937. Example         Read the file stamp for Boosters.Pas.
  938.                    FileStamp ( 'Boosters.Pas',0,Ecode );
  939.                    if Ecode = 0 then begin
  940.                       WriteLn(FileHH,':',FileMin,':',FileSec);
  941.                       WriteLn(FileMM,'/',FileDD, '/',FileYY-1900);
  942.                    end;
  943.  
  944. -----------------------------------------------------------
  945. FillHeap Procedure
  946. -----------------------------------------------------------
  947. Purpose         Initializes a block of heap.
  948. Declaration     FillHeap ( Page : HeapBuf;
  949.                            x1,y1,x2,y2 : Integer;
  950.                            C : Char; Att : Byte );
  951. Remarks         The block defined by (x1,y1) and (x2,y2) is
  952.                 set to values specified by C and Att.
  953. Example         Clear a page of heap without disturbing the 
  954.                 screen.
  955.                   FillHeap ( 1,1,80,25,#32,7 );
  956.                    
  957. -----------------------------------------------------------
  958. FindStr Procedure
  959. -----------------------------------------------------------
  960. Purpose         Searches video memory for string S, 
  961.                 positioning the cursor at a specified point
  962.                 relative to S.
  963. Declaration     FindStr ( x,y : Integer; s : string;
  964.                           offset : Integer;
  965.                           var ecode : Integer );
  966. Remarks         Beginning at (x,y), FindStr searches for S.
  967.                 If S is found, FindStr sets Ecode = 0 and 
  968.                 places the cursor according to the value of 
  969.                 OffSet:
  970.  
  971.                    OffSet     Cursor Placement
  972.                     =0          S[1]
  973.                     <0          S[1]-OffSet
  974.                     >0          S[1]+OffSet
  975.  
  976.                 If FindStr can't find S, it sets Ecode = 1 and
  977.                 puts the cursor at (80,25).
  978. See also        FstrHeap
  979. Example         Search for 'log' and highlight the 'g' if
  980.                 found.  
  981.                    FindStr ( 1,1,'log',2,ecode);
  982.                    if ecode = 0 then
  983.                       SetAtt (Wherex,WhereY,WhereX,WhereY,112);
  984.  
  985. -----------------------------------------------------------
  986. Fstr Function
  987. -----------------------------------------------------------
  988. Purpose         Converts a LongInt to a string.
  989. Declaration     Fstr (num:LongInt; width:Integer) : String;
  990. Result Type     String
  991. Remarks         Num is converted to a string, right-justified
  992.                 in a field of Width characters.  This is 
  993.                 Turbo's Str procedure made available as a 
  994.                 function for convenience.
  995. Example         Display Integer 15 using Pdq.
  996.                    n := 15;
  997.                    Pdq('e',Fstr(n,3),15,5,14);
  998.  
  999. -----------------------------------------------------------
  1000. FstrHeap Procedure
  1001. -----------------------------------------------------------
  1002. Purpose         Searches a page of heap for string S.
  1003. Declaration     FstrHeap ( Hpage:HeapBuf; S:String;
  1004.                            var x,y,ecode : Integer);
  1005. Remarks         Beginning at (x,y) on Page, FstrHeap searches 
  1006.                 for S.  If S is found, FstrHeap sets Ecode = 0
  1007.                 and returns the coordinates of S[1] in (x,y).
  1008.                 FstrHeap sets Ecode = 1 if it cannot find
  1009.                 S on Page.
  1010. See also        FindStr
  1011. Example         Find 'log' on page 1 of the heap and load 
  1012.                 it into S.
  1013.                    x := 1;
  1014.                    y := 1;
  1015.                    FstrHeap ( Page[1],'log',x,y,ecode );
  1016.                    if ecode = 0 then
  1017.                       GetHeap ( Page[1],h,s,x,y,3);
  1018.  
  1019. -----------------------------------------------------------
  1020. GchaHeap Function
  1021. -----------------------------------------------------------
  1022. Purpose         Gets a character/attribute word from the heap.
  1023. Declaration     GchaHeap ( Hpage:HeapBuf; x,y:Integer ) :Integer;
  1024. Result Type     Integer
  1025. Remarks         Returns the character/attribute pair located
  1026.                 at (x,y) on Page.
  1027. See also        PchaHeap
  1028. Example         Get the character/attribute combination at 1,1
  1029.                 on page 2 of the heap.
  1030.                    n := GchaHeap ( Page[2],1,1);
  1031.  
  1032. -----------------------------------------------------------
  1033. GetAtt Function
  1034. -----------------------------------------------------------
  1035. Purpose         Gets the video attribute at (x,y).
  1036. Declaration     GetAtt ( x,y:Integer ) : byte;
  1037. Result Type     Byte
  1038. Remarks         Returns the attribute found at (x,y) of 
  1039.                 video memory.
  1040. See also        GetChar, HeapAtt.
  1041. Example         Get the attribute associated with the first
  1042.                 character of the string, 'Menu', in video
  1043.                 memory.
  1044.                    FindStr ( 1,1,'Menu',0,ecode);
  1045.                    if ecode = 0 then 
  1046.                       n := GetAtt ( WhereX,WhereY );
  1047.  
  1048. -----------------------------------------------------------
  1049. GetChar Function
  1050. -----------------------------------------------------------
  1051. Purpose         Gets the character at (x,y) on the screen.
  1052. Declaration     GetChar ( x,y:Integer ) : Char;
  1053. Result Type     Char
  1054. Remarks         Returns the character found at (x,y) of 
  1055.                 video memory.
  1056. See also        GetAtt.
  1057. Example         Get the character following the colon on 
  1058.                 line 3 of the screen.
  1059.                    FindStr ( 1,3,':',1,ecode);
  1060.                    if ecode = 0 then 
  1061.                       c := GetChar ( WhereX,WhereY );
  1062.  
  1063. -----------------------------------------------------------
  1064. GetHeap Procedure
  1065. -----------------------------------------------------------
  1066. Purpose         Reads a string from a page of heap.
  1067. Declaration     GetHeap ( Hpage:HeapBuf; hv:Char; S:String;
  1068.                           x,y,len : Integer );
  1069. Remarks         Reads Len characters into S beginning at
  1070.                 (x,y) of Page.  If HV = 'V' or 'v', then
  1071.                 the read direction is vertical or top-to-
  1072.                 bottom.  If HV is any other character, the
  1073.                 read direction will be horizontal or left-
  1074.                 to-right.
  1075. See also        GetStr
  1076. Example         Read 'October' from 15,5 of Page 1.
  1077.                    GetHeap ( Page[1],h,15,5,7 );
  1078.  
  1079. -----------------------------------------------------------
  1080. GetSize Procedure 
  1081. -----------------------------------------------------------
  1082. Purpose         Returns the size of a disk file.
  1083. Declaration     GetSize ( FileDesc:String; var Size:LongInt;
  1084.                           var Ecode:Integer );
  1085. Remarks         Returns the number of bytes in the drive/path/
  1086.                 file specified by FileDesc.  If Ecode = 0, the
  1087.                 file was found and Size = filesize.  If Ecode
  1088.                 <> 0, then a problem occurred and Size is
  1089.                 unchanged.
  1090. Example         Get the size of a file in bytes.
  1091.                    GetSize ( '\pascal\tp.exe',size,ecode );
  1092.                    if ecode = 0 then
  1093.                       write('Tp.Exe is ',size div 1024,'K');
  1094.  
  1095. -----------------------------------------------------------
  1096. GetStr Procedure 
  1097. -----------------------------------------------------------
  1098. Purpose         Reads a string from the screen.
  1099. Declaration     GetStr ( hv:Char; S:String; X,Y:Integer;
  1100.                          Len:Byte );
  1101. Remarks         Reads Len characters into S beginning at 
  1102.                 (x,y) on the screen.  If HV = 'V' or 'v' then
  1103.                 the read direction is vertical or top-to-
  1104.                 bottom.  If HV is any other character, then
  1105.                 the read direction is horizontal or left-to-
  1106.                 right.
  1107. See also        GetHeap
  1108. Example         Read the date from the screen.
  1109.                    Assuming the string '12/25/89' begins
  1110.                    at 1,25 on the screen, then
  1111.                       GetStr ( h,Today,1,25,8 );
  1112.                    will store it in the string 'Today'.
  1113.  
  1114. -----------------------------------------------------------
  1115. Heap2Scr Procedure 
  1116. -----------------------------------------------------------
  1117. Purpose         Copies a block of heap to the screen.
  1118. Declaration     Heap2Scr ( Hpage:HeapBuf; x1,y1,x2,y2,x3,y3:
  1119.                            Integer );
  1120. Remarks         Copies the block on Page defined by (x1,y1) 
  1121.                 and (x2,y2) to the screen beginning at
  1122.                 (x3,y3).
  1123. See also        RestoreScreen,Scr2Heap
  1124. Example         Display a menu on the current screen.
  1125.  
  1126.                    {---  Save the current screen  ---}
  1127.                    SaveScreen ( Page[1] );
  1128.  
  1129.                    {---  Copy the menu to (60,1) of the 
  1130.                          Screen  ---}
  1131.                    Heap2Scr ( Page[2],1,1,15,10,60,1 );
  1132.  
  1133.                    {---  Wait for a keypress  ---}
  1134.                    c := readkey;
  1135.                    if c = #0 then c := readkey;
  1136.                        .
  1137.                        .
  1138.                    {---  Erase the menu  ---}
  1139.                    RestoreScreen ( Page[1] );
  1140.  
  1141. -----------------------------------------------------------
  1142. HeapAtt Procedure 
  1143. -----------------------------------------------------------
  1144. Purpose         Sets the video attributes of a screen image
  1145.                 stored on the heap.
  1146. Declaration     HeapAtt ( Hpage:HeapBuf; x1,y1,x2,y2:Integer;
  1147.                           Att:Byte );
  1148. Remarks         Sets all locations to attribute Att for the
  1149.                 block defined by (x1,y1) and (x2,y2) on Page.
  1150. See also        SetAtt
  1151. Example         Set the attributes of Page[1] to reverse video.
  1152.                    HeapAtt ( Page[1],1,1,80,25,112 );
  1153.  
  1154. -----------------------------------------------------------
  1155. Hex Function 
  1156. -----------------------------------------------------------
  1157. Purpose         Converts an integer to a hexadecimal string.
  1158. Declaration     Hex ( DecimalValue : Word ) : String;
  1159. Result Type     String
  1160. Remarks         The four nibbles of DecimalValue are expressed
  1161.                 as a hexadecimal constant in ascii.
  1162. Example         Express 16384 as a hex string.
  1163.                    write( Hex(16384) );
  1164.                    { will display 4000 }
  1165.  
  1166. -----------------------------------------------------------
  1167. Hwipe Procedure
  1168. -----------------------------------------------------------
  1169. Purpose         Horizontally wipes a block from the heap to
  1170.                 the screen.
  1171. Declaration     Hwipe ( Hpage:HeapBuf; x1,y1,x2,y2,x3,y3,
  1172.                         delay : Integer );
  1173. Remarks         Creates a horizontal wipe effect by writing
  1174.                 a block from the heap to the screen one
  1175.                 column at a time.  Delay controls the speed
  1176.                 of the wipe.
  1177.  
  1178.                 Hwipe takes the block at (x1,y1) and (x2,y2)
  1179.                 and writes it to (x3,y3) of the screen.
  1180. See also        Vwipe, Tile, SplitOpenH, SplitCloseH,
  1181.                 SplitOpenV, SplitCloseV
  1182. Example         Wipe Page[1] to the screen.
  1183.                    Hwipe ( Page[1], 1,1,80,25,1,1,5 );
  1184.  
  1185. -----------------------------------------------------------
  1186. Input Procedure
  1187. -----------------------------------------------------------
  1188. Purpose         Gets filtered data from the keyboard (Stdin).
  1189. Declaration     Input ( x,y : Integer; Filter : String;
  1190.                         var Data : String; var LastCh : Char;
  1191.                         Att : Byte );
  1192. Remarks         Positions the cursor at (x,y) and waits for
  1193.                 a keypress.  The contents of Filter determine
  1194.                 which characters are accepted and placed in
  1195.                 Data.  Input is terminated when an Esc, CR,
  1196.                 Tab, Reverse Tab, or EOF is received.  The
  1197.                 terminating character is placed in LastCh.
  1198.                 Att is the attribute of the input characters
  1199.                 as they appear on the screen.
  1200.  
  1201.                 Input initializes Data to a string of blanks
  1202.                 equal in length to Filter.  If the procedure
  1203.                 is terminated with an Esc, Data is returned
  1204.                 as a null string.  Otherwise, Data is returned
  1205.                 with the accepted keypresses and the blanks.
  1206.  
  1207.                 Filter Values   Allowable keystrokes or program
  1208.                                 response
  1209.                      C             Any character
  1210.                      D             0..9
  1211.                      I             0..9 space
  1212.                      R             0..9 . space
  1213.                      S             + - space
  1214.                      space         Input denied at this position;
  1215.                                    cursor advanced right 1 position
  1216.                      All others    Keystroke must match Filter
  1217.                                    value.
  1218.  
  1219.                 Tab and Reverse Tab are used as terminators to
  1220.                 allow users to key data into multiple input
  1221.                 fields by tabbing between them.
  1222.  
  1223.                 Input accepts left and right cursor arrows
  1224.                 to move the cursor.  When an end of field is
  1225.                 reached, Input wraps to the other end.
  1226. See also        Input2
  1227. Example         Accept the user's social security number.
  1228.                    {---  Define acceptable keystrokes  ---}
  1229.                    Filter := 'DDD DD DDDD';
  1230.  
  1231.                    {---  Display the message and field format  ---}
  1232.                    Message := 'Enter your SSN: ';
  1233.                    Len := Length(Message);
  1234.                    PutStr (h,Message,10,8,14 );
  1235.                    PutStr (h,'-  -',Len+13,8,14);
  1236.  
  1237.                    {---  Get user's SSN  ---}
  1238.                    Input ( Len+10,8,Filter,Data,LastKey,14 );
  1239.                    if LastKey <> #27 then begin
  1240.                       Data := strip(Data);
  1241.                       Data := translate(Data,'-',' ',' ');
  1242.                    end;
  1243.  
  1244. -----------------------------------------------------------
  1245. Input2 Procedure
  1246. -----------------------------------------------------------
  1247. Purpose         Gets filtered data from the keyboard (Stdin).
  1248. Declaration     Input2 ( x,y : Integer; Filter : String;
  1249.                          var Data : String; var LastCh : Char;
  1250.                          Att : Byte );
  1251. Remarks         Positions the cursor at (x,y) and waits for
  1252.                 a keypress.  Differs from Input Procedure by
  1253.                 allowing Function keys F1-F10 to terminate
  1254.                 processing.
  1255.  
  1256. -----------------------------------------------------------
  1257. LastPos Function
  1258. -----------------------------------------------------------
  1259. Purpose         Returns the starting position of Needle in
  1260.                 HayStack by searching backwards.
  1261. Declaration     LastPos ( Needle, HayStack : String;
  1262.                           Start : Integer ) : Integer;
  1263. Result Type     Integer;
  1264. Remarks         Begins at Start and proceeds towards the 
  1265.                 beginning of HayStack until Needle is found
  1266.                 or HayStack is exhausted.  If Needle is
  1267.                 found, LastPos returns its starting position
  1268.                 in HayStack.  LastPos returns zero when:
  1269.                    - Needle is not found
  1270.                    - Needle is longer than HayStack
  1271.                    - Start is less than 1 or greater than
  1272.                      the length of HayStack
  1273.                    - Needle is null
  1274.                    - HayStack is null
  1275. See also        PosR, Pos (Turbo Pascal)
  1276. Example         Find the position of the last 's' in 'Boosters'.
  1277.                    LastS := LastPos ( 's','Boosters', 8);
  1278.                    {---  LastS will equal 8  ---}
  1279.  
  1280. -----------------------------------------------------------
  1281. Left Function
  1282. -----------------------------------------------------------
  1283. Purpose         Left-justifies and pads a string in a field.
  1284. Declaration     Left ( S : String; Width : Integer;
  1285.                        Pad : Char ) : String;
  1286. Result Type     String
  1287. Remarks         Returns S left-justified and padded on the
  1288.                 right with Pad characters, if necessary, in 
  1289.                 a field of size Width.
  1290. See also        Right, Center
  1291. Example         Left-justify 'Name' for data entry.
  1292.                    Field1 := Left('Name ',35,'_');
  1293.  
  1294. -----------------------------------------------------------
  1295. Lower Function
  1296. -----------------------------------------------------------
  1297. Purpose         Converts uppercase characters to lowercase.
  1298. Declaration     Lower ( S : String ) : String;
  1299. Result Type     String
  1300. Remarks         Returns a string with all uppercase characters 
  1301.                 of S converted to lowercase.
  1302. See also        Upper
  1303. Example         Ensure that a string is all lowercase.
  1304.                    S := Lower( S );
  1305.  
  1306.  
  1307.  
  1308.